
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package assignment1;

/**
 *
 * @author cjaramillo
 */

public class Cell
{
    public enum State {UNKNOWN, CLEAR, OBSTACLE, ROVER, TARGET};    
    private State m_state;
    private Rover m_rover;
    
    Cell()
    {
        m_state = State.UNKNOWN;
    }
    
    @Override
    public String toString()
    {
        String retval=" ";
        switch(m_state)
        {
            case UNKNOWN:
                retval = "?";
                break;
            case CLEAR:
                retval = "O";
                break;
            case OBSTACLE:
                retval = "X";
                break;
            case TARGET:
                retval = "T";
                break;
            case ROVER:
                retval = m_rover.toString();
                break;
        }
        return retval;
    }
    
    public void state(State state)
    {
        m_state = state;
    }
    
    public State state()
    {
        return m_state;
    }
    
    public void setTarget()
    {
        m_state = State.TARGET;
    }
    
    public void setClear()
    {
        m_state = State.CLEAR;
    }
    
    public void setRover(Rover rover)
    {
        m_state = State.ROVER;
        m_rover = rover;
    }
}